package cn.iocoder.yudao.module.dr.dal.mysql.journalapply;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dr.controller.admin.journalapply.vo.JournalApplyPageReqVO;
import cn.iocoder.yudao.module.dr.dal.dataobject.journalapply.JournalApplyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dr.controller.admin.journalapply.vo.*;

/**
 * 期刊申请 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface JournalApplyMapper extends BaseMapperX<JournalApplyDO> {

    default PageResult<JournalApplyDO> selectPage(JournalApplyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<JournalApplyDO>()
                .eqIfPresent(JournalApplyDO::getApplyCode, reqVO.getApplyCode())
                .eqIfPresent(JournalApplyDO::getApplyUserId, reqVO.getApplyUserId())
                .eqIfPresent(JournalApplyDO::getPhone, reqVO.getPhone())
                .betweenIfPresent(JournalApplyDO::getUseEndTime, reqVO.getUseEndTime())
                .eqIfPresent(JournalApplyDO::getApplyReson, reqVO.getApplyReson())
                .eqIfPresent(JournalApplyDO::getFile, reqVO.getFile())
                .eqIfPresent(JournalApplyDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(JournalApplyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(JournalApplyDO::getId));
    }

}